import mitt from 'mitt';

type MittEvents = {
  GLOBAL_INITIALIZE_ROUTE_MITT?: string;
  GLOBAL_REFRESH_ROUTE_MITT?: string;
  UPDATE_DRAMA_LIST_MITT: string;
};
type MittKey = keyof MittEvents;

/** 重置路由路由的key (关闭所有标签回到首页并刷新首页) */
export const GLOBAL_INITIALIZE_ROUTE_MITT: MittKey = 'GLOBAL_INITIALIZE_ROUTE_MITT';
/** 刷新某个路由  */
export const GLOBAL_REFRESH_ROUTE_MITT: MittKey = 'GLOBAL_REFRESH_ROUTE_MITT';
/** 更新剧集列表  */
export const UPDATE_DRAMA_LIST_MITT: MittKey = 'UPDATE_DRAMA_LIST_MITT';

/**
 * 全局事件总线
 */
export const $mitt = mitt<MittEvents>();
